package org.hishen.example.entity.system;

import java.io.IOException;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;
import org.hishen.example.entity.AbstractBaseEntity;
import org.hishenframework.data.annotation.Label;
import org.hishenframework.tool.codegenerate.CodeBuilder;

@Label("用户")
@Entity
@Table(name = "sys_user")
public class User extends AbstractBaseEntity {

	public static void main(String[] args) throws IOException {
		CodeBuilder.builder(User.class);
	}
	
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@Label("用户名")
	@NotBlank(message = "用户名不能为空")
	@Column(length = 20)
	private String username;

	@Label("密码")
	@NotBlank
	@Column(length = 32)
	private String password;
	
	@Label("年龄")
	@Range(min = 0, max = 100)
	private Integer age;
	
	@Label("管理权限")
	private Boolean role;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Boolean getRole() {
		return role;
	}

	public void setRole(Boolean role) {
		this.role = role;
	}
}
